package test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadMain {
	public static void main(String[] args) {
		ExecutorService exec = Executors.newCachedThreadPool();
		int numOfProduct = 5;
		int numOfConsumer = 10;
		ThreadStorage storage = new ThreadStorage();
		for (int i = 0; i < numOfProduct; i++) {
			exec.execute(new ThreadProducter(storage));
		}
		
		for (int i = 0; i < numOfConsumer; i++) {
			exec.execute(new ThreadConsumer(storage));
		}
		
		exec.shutdown();
		System.out.println(exec.isShutdown());
		System.out.println("Back to Main.");
	}
}
